<h:panelGrid xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:t="http://myfaces.apache.org/tomahawk" width="100%">

	<h:panelGrid width="100%" id="pnlUploadInfo">
		<h:inputHidden value="#{evokPatientTherapyBean.att.id}" />
		<p:panelGrid style="width:100%" columns="2"
			columnClasses="width30,width70">
			<h:outputLabel value="#{msgs.table_index}" />
			<p:keyboard value="#{evokPatientTherapyBean.att.sort}"
				showMode="button" keypadOnly="true" />

			<h:outputLabel value="#{msgs.common_create_date}" />
			<p:calendar value="#{evokPatientTherapyBean.att.createDate}"
				navigator="true" label="#{msgs.common_create_date}"
				pattern="dd/MM/yyyy" />

			<h:outputLabel value="#{msgs.default_upload}" />
			<h:panelGroup>
				<t:inputFileUpload id="therapyatt" accept="docs/*" size="50"
					value="#{evokPatientTherapyBean.therapyAtt}" storage="file"
					styleClass="fileUploadInput" maxlength="100000" />
			</h:panelGroup>
			
			<h:outputLabel value="#{msgs.domain_remark}" />
			<p:inputTextarea value="#{evokPatientTherapyBean.att.remark}"
				rows="4" style="width:90%" maxlength="250" />
		</p:panelGrid>
	</h:panelGrid>

	<h:panelGrid style="float:right;" columns="2">
		<p:commandButton action="#{evokPatientTherapyBean.uploadAtt}"
			ajax="false" icon="ui-icon-disk" value="#{msgs.button_submit}"
			update="tblAtt" />

		<p:commandButton actionListener="#{evokPatientTherapyBean.resetAtt}"
			icon="ui-icon-arrowrefresh-1-n" value="#{msgs.button_reset}"
			update="pnlUploadInfo" />
	</h:panelGrid>

	<p:dataTable value="#{evokPatientTherapyBean.attmodel}" var="att"
		id="tblAtt" selectionMode="single" widgetVar="wdgAtt" emptyMessage="">
		<p:ajax event="rowSelect"
			update=":mainform:tabviewTherapy:pnlUploadInfo"
			listener="#{evokPatientTherapyBean.selectAtt}" />

		<p:column headerText="#{msgs.table_index}">
			<h:outputText value="#{att.sort}" />
		</p:column>

		<p:column headerText="#{msgs.common_create_date}">
			<h:outputText value="#{att.createDate}" converter="dateConverter"/>
		</p:column>

		<p:column headerText="#{msgs.default_name}">
			<h:outputText value="#{att.attName}" />
		</p:column>

		<p:column headerText="#{msgs.table_column_operation}"
			styleClass="gridNoBorder">
			<h:panelGrid columns="2" styleClass="gridNoBorder">
				<h:outputLink target="_blank" styleClass="ui-icon ui-icon-link"
					value="#{att.path}" rendered="#{att.path!=null}"
					title="#{msgs.default_download}">
				</h:outputLink>

				<p:commandLink oncomplete="confirmDeleteAtt.show()"
					styleClass="ui-icon ui-icon-trash" title="#{msgs.button_delete}"
					type="image">
					<f:setPropertyActionListener value="#{att}"
						target="#{evokPatientTherapyBean.att}" />
				</p:commandLink>
			</h:panelGrid>
		</p:column>
	</p:dataTable>
</h:panelGrid>
